package com.lagou.edu.pojo;

import org.springframework.beans.factory.FactoryBean;

/**
 * 工厂bean 账户表
 */
public class AccountFactoryBean implements FactoryBean {

    private String accountInfo;

    public void setAccountInfo(String accountInfo) {
        this.accountInfo = accountInfo;
    }

    @Override
    public Object getObject() throws Exception {
        Account account = new Account();
        String[] split = accountInfo.split(",");
        account.setCardNo(split[0]);
        account.setName(split[1]);
        account.setMoney(Integer.parseInt(split[2]));
        return account;
    }

    @Override
    public Class<?> getObjectType() {
        return Account.class;
    }

    @Override
    public boolean isSingleton() {
        return false;
    }
}
